package ro.utcn.tp.taskManagement.utils;

import org.hibernate.HibernateException;
import org.hibernate.Transaction;

/**
 * @author Coni
 * 
 */
public class DBUtils {
	//private static final Logger logger = Logger.getLogger(DBUtils.class);

	public static final int DB_TRUE = 1;

	public static final int DB_FALSE = 0;

	public static char NORMAL_WILDCARD = '*';

	public static char DB_WILDCARD = '%';

	// private static final int UNIQUE_CONSTRAINT_VIOLATED_CODE = 1;
	//
	// private static final int FOREIGN_KEY_CONSTRAINT_VIOLATED_CODE = 2292;
	//
	// private static final String GET_DB_DATA_SQL = "SELECT SYSDATE CurrentDate
	// FROM DUAL ";

	/**
	 * Rolls back the transaction t
	 * 
	 * @param t
	 *            A Transaction instance
	 * @throws PersistenceException
	 */
	public static void rollback(Transaction t) throws Exception {
		if (t != null) {
			try {
				t.rollback();
			} catch (HibernateException hibernateException) {
				//logger.error("", hibernateException);
				throw new Exception(hibernateException);
			}
		}
	}

}
